package oicq.wlogin_sdk.tools;

public class util {
    public static void LOGI(String s, String s1) {
    }

    public static final int E_TLV_VERIFY = -1005;
    public static final int E_TLV_DECRYPT = -1015;

    public static void int64_to_buf32(byte[] bArr, int i2, long j2) {
        bArr[i2 + 3] = (byte) ((int) (j2 >> 0));
        bArr[i2 + 2] = (byte) ((int) (j2 >> 8));
        bArr[i2 + 1] = (byte) ((int) (j2 >> 16));
        bArr[i2 + 0] = (byte) ((int) (j2 >> 24));
    }

    public static void int64_to_buf(byte[] bArr, int i2, long j2) {
        bArr[i2 + 7] = (byte) ((int) (j2 >> 0));
        bArr[i2 + 6] = (byte) ((int) (j2 >> 8));
        bArr[i2 + 5] = (byte) ((int) (j2 >> 16));
        bArr[i2 + 4] = (byte) ((int) (j2 >> 24));
        bArr[i2 + 3] = (byte) ((int) (j2 >> 32));
        bArr[i2 + 2] = (byte) ((int) (j2 >> 40));
        bArr[i2 + 1] = (byte) ((int) (j2 >> 48));
        bArr[i2 + 0] = (byte) ((int) (j2 >> 56));
    }

    public static void int16_to_buf(byte[] bArr, int i2, int i3) {
        bArr[i2 + 1] = (byte) (i3 >> 0);
        bArr[i2 + 0] = (byte) (i3 >> 8);
    }

    public static void int8_to_buf(byte[] bArr, int i2, int i3) {
        bArr[i2 + 0] = (byte) (i3 >> 0);
    }

    public static void int32_to_buf(byte[] bArr, int i2, int i3) {
        bArr[i2 + 3] = (byte) (i3 >> 0);
        bArr[i2 + 2] = (byte) (i3 >> 8);
        bArr[i2 + 1] = (byte) (i3 >> 16);
        bArr[i2 + 0] = (byte) (i3 >> 24);
    }

    public static String buf_to_string(byte[] bArr) {
        String str = "";
        if (bArr == null) {
            return str;
        }
        for (int i2 = 0; i2 < bArr.length; i2++) {
            str = (str + Integer.toHexString((bArr[i2] >> 4) & 15)) + Integer.toHexString(bArr[i2] & 15);
        }
        return str;
    }

    public static int buf_to_int16(byte[] bArr, int i2) {
        return ((bArr[i2] << 8) & 65280) + ((bArr[i2 + 1] << 0) & 255);
    }

    public static int buf_to_int8(byte[] bArr, int i2) {
        return bArr[i2] & -1;
    }

    public static String buf_to_string(byte[] arg3, int arg4) {
        String v0 = "";
        if(arg3 == null) {
            return v0;
        }

        if(arg4 > arg3.length) {
            arg4 = arg3.length;
        }

        int v1;
        for(v1 = 0; v1 < arg4; ++v1) {
            v0 = v0 + Integer.toHexString(arg3[v1] >> 4 & 15);
            v0 = v0 + Integer.toHexString(arg3[v1] & 15);
        }

        return v0;
    }

    public static byte get_char(byte b) {
        int i;
        if (b < 48 || b > 57) {
            byte b2 = 97;
            if (b < 97 || b > 102) {
                b2 = 65;
                if (b < 65 || b > 70) {
                    return 0;
                }
            }
            i = (b - b2) + 10;
        } else {
            i = b - 48;
        }
        return (byte) i;
    }

    public static byte[] string_to_buf(String str) {
        if (str == null) {
            return new byte[0];
        }
        byte[] bArr = new byte[(str.length() / 2)];
        for (int i = 0; i < str.length() / 2; i++) {
            int i2 = i * 2;
            bArr[i] = (byte) ((get_char((byte) str.charAt(i2)) << 4) + get_char((byte) str.charAt(i2 + 1)));
        }
        return bArr;
    }

    public static long buf_to_int64(byte[] bArr, int i2) {
        return ((((long) bArr[i2]) << 56) & -72057594037927936L) + 0 + ((((long) bArr[i2 + 1]) << 48) & 71776119061217280L) + ((((long) bArr[i2 + 2]) << 40) & 280375465082880L) + ((((long) bArr[i2 + 3]) << 32) & 1095216660480L) + ((((long) bArr[i2 + 4]) << 24) & 4278190080L) + ((((long) bArr[i2 + 5]) << 16) & 16711680) + ((((long) bArr[i2 + 6]) << 8) & 65280) + ((((long) bArr[i2 + 7]) << 0) & 255);
    }

    public static int buf_to_int32(byte[] bArr, int i2) {
        return ((bArr[i2] << 24) & -16777216) + ((bArr[i2 + 1] << 16) & 16711680) + ((bArr[i2 + 2] << 8) & 65280) + ((bArr[i2 + 3] << 0) & 255);
    }
}
